package parcview.simulation;

import parcview.interfaces.CarIF;
import parcview.interfaces.WaitingQueueIF;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class WaitingQueue implements WaitingQueueIF {
	
	private Queue<CarIF> waiting;
	
	public WaitingQueue() {
		this.waiting = new LinkedList<CarIF>();
	}

	@Override
	public List<CarIF> getWaitingCars() {
		return new LinkedList<CarIF>(this.waiting);
	}

	@Override
	public CarIF getFirstCar() {
		return this.waiting.peek();
	}

	@Override
	public CarIF removeFirstCar() {
		return this.waiting.poll();		
	}

	@Override
	public void queueCar(CarIF car) {
		this.waiting.offer(car);
                
	}

	@Override
	public int size() {
		return this.waiting.size();
	}

}
